package io.r2mo.test.common.controller.gen.orderitem;

import io.r2mo.test.common.service.gen.orderitem.IOrderItemServiceV1;
import io.r2mo.test.common.domain.OrderItemEntity;
import io.r2mo.spring.common.webflow.BaseController;
import io.r2mo.typed.common.Pagination;
import io.r2mo.typed.json.JObject;
import io.r2mo.typed.webflow.R;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * OrderItem Controller接口
 * </p>
 *
 * @author lang
 * @since 2025-09-22
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/v1/orderitem")
public class OrderItemCrudControllerV1 extends BaseController<OrderItemEntity, OrderItemCommonRequest, OrderItemCommonResponse> implements OrderItemCrudController {

    @Autowired
    private IOrderItemServiceV1 service;

    @Override
    protected IOrderItemServiceV1 service() {
        return this.service;
    }

    @Override
    protected OrderItemCommonResponse createResponse() {
        return new OrderItemCommonResponse();
    }

    @Override
    protected OrderItemCommonRequest createRequest() {
        return new OrderItemCommonRequest();
    }

    // POST /v1/orderitem
    @Override
    public R<OrderItemCommonResponse> createSingle(final OrderItemCommonRequest request) {
        return super.createSingle(request);
    }

    // PUT /v1/orderitem/{id}
    @Override
    public R<OrderItemCommonResponse> updateSingle(final String id, final OrderItemCommonRequest request) {
        return super.updateSingle(id, request);
    }

    // GET /v1/orderitem/{id}
    @Override
    public R<OrderItemEntity> findSingle(final String id) {
        return super.findSingle(id);
    }

    // DELETE /v1/orderitem/{id}
    @Override
    public R<Boolean> removeSingle(final String id) {
        return super.removeSingle(id);
    }

    // POST /v1/orderitem/search
    @Override
    public R<Pagination<OrderItemEntity>> findPage(final JObject query) {
        return super.findPage(query);
    }

    // GET /v1/orderitem/all
    @Override
    public R<List<OrderItemEntity>> findAll() {
        return super.findAll();
    }

    // POST /v1/orderitem/import
    @Override
    public R<Boolean> uploadData(final MultipartFile file, final JObject config) {
        return super.uploadData(file, config);
    }

    // POST /v1/orderitem/export
    @Override
    public void downloadBy(final JObject query) {
        super.downloadBy(query);
    }
}